/**
 * @author Tobias Boehm
 *
 * 16.05.2011
 */
package org.anddev.andengine.extension.tbsengine.message.client.preparematch;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.UUID;

import org.anddev.andengine.extension.tbsengine.message.client.AbsClientMatchMessage;

/**
 * This is an abstract class for client messages that request the change of
 * a player slot component (Faction, Team, etc.).
 * <p>
 * You should use this class if you want to develop custom slot change request
 * messages.
 * 
 * @author Tobias Boehm
 *
 */
public abstract class AbsClientSlotChangeRequestMessage extends AbsClientMatchMessage {

	protected long mSlotID = -1;
	
	@Override
	protected void onReadTransmissionClientMatchData(final DataInputStream pDataInputStream) throws IOException{
		
		this.mSlotID = pDataInputStream.readLong();

		this.onReadTransmissionClientSlotRequestData(pDataInputStream);
	}
	
	protected abstract void onReadTransmissionClientSlotRequestData(final DataInputStream pDataInputStream) throws IOException;
	
	@Override
	protected void onWriteTransmissionClientMatchData(final DataOutputStream pDataOutputStream) throws IOException {
		
		pDataOutputStream.writeLong(this.mSlotID);

		this.onWriteTransmissionClientSlotRequestData(pDataOutputStream);
	}
	
	protected abstract void onWriteTransmissionClientSlotRequestData(final DataOutputStream pDataOutputStream) throws IOException;
	
	/**
	 * @return the mSlotID
	 */
	public long getSlotID() {
		return mSlotID;
	}

	/**
	 * @param matchID the matchID to set
	 */
	public void setMatchID(final UUID pMatchID) {
		this.mMatchID = pMatchID;
	}
	
	/**
	 * @param mSlotID the mSlotID to set
	 */
	public void setSlotID(final long pSlotID) {
		this.mSlotID = pSlotID;
	}
}
